using System.Windows;
using System.Windows.Controls;

namespace FrontDisplay
{
    internal sealed class PluginParameters
    {
        public TabItem TabItem { get; private set; }

        private IPlugin _plugin;
        private UIElement _parametersPage;

        public PluginParameters(IPlugin plugin, UIElement parametersPage)
        {
            _plugin = plugin;
            _parametersPage = parametersPage;
            TabItem = new TabItem
                {
                    Header = plugin.Title,
                    Content = parametersPage
                };
        }

        internal void UpdateTitle()
        {
            TabItem.Header = _plugin.Title;
        }

        public void SaveConfig()
        {
            _plugin.SaveConfig(_parametersPage);
        }
    }
}